package com.junbao.module.main

import android.content.Context
import android.view.View
import android.widget.ImageView
import androidx.databinding.BindingAdapter
import com.bumptech.glide.Glide

/**
 *    author : Majunbao
 *    github : https://github.com/MaJunBaox
 *    time   : 2022/8/28 3:28 下午
 *    desc   :
 */
class ImageUtils {

    @BindingAdapter("app:loadImgUrl")
    fun loadImgUrl(view: View,context:Context ,url:String){
        Glide.with(context).load(url).into(view as ImageView)
    }


    @BindingAdapter("app:goneUnless")
    fun goneUnless(view: View,visible:Boolean){
        view.visibility = if (visible) View.VISIBLE else View.GONE
    }
}